import React from "react"
import {plus, minus} from "../../redux/reducer/count"
import {connect} from "react-redux"

function CountUI(props) {
  const plus=()=>{
    props.plus(1)
  }
  const minus=()=>{
    props.minus(1)
  }

  return (
    <div>
    <p>结果:{props.counter.value}</p>
    <button onClick={plus}>+</button>
    <button onClick={minus}>-</button>
    <div>
      <p>人数: {props.person.value.length}</p>
    </div>
  </div>
  )
}

export default connect(
  state=> ({person:state.person, counter:state.counter}),
  { plus, minus }
  )(CountUI)
